#pragma once
#include <iostream>
#include <string>
#include "Util.hpp"

// log level
enum
{
    INFO,
    DEBUG,
    WARNING,
    ERROR,
    FATAL
};

// LOG() << "xxxxxx";
inline std::ostream& Log(const std::string& level, const std::string& file_name, int line)
{
    std::string message = "[ " + level + " ]";       // 添加日志等级
    message += "[ " + Util::GetTimeStamp() + " ]";   // 获取日志时间
    message += "[ " + file_name + " ]";              // 获取报错文件
    message += "[ " + std::to_string(line) + " ]";   // 获取报错行号

    std::cout << message + " "; // 存入缓冲区，不刷新待填充报错信息

    return std::cout;
}

#define LOG(level) Log(#level, __FILE__, __LINE__)
